<template>
  <Collapse simple :model-value="['dictData','childDict']">
    <Panel name="dictData">
      字典数据
      <template #content>
        <DictDataMgr ref="DictDataMgr" @reloadData="reloadData"/>
      </template>
    </Panel>
    <Panel name="childDict">
      子字典
      <template #content>
        <ChildDictMgr ref="ChildDictMgr" @reloadData="reloadData"/>
      </template>
    </Panel>
  </Collapse>
</template>

<script>
import DictDataEdit from "./SysDictDataEdit.vue";
import DictDataMgr from "./SysDictDataMgr.vue";
import ChildDictMgr from "./SysChildDictMgr.vue";
import {cleanDictCache} from "@/util";

export default {
  name: "SysDictDetailsMgr",
  components: {DictDataEdit, DictDataMgr, ChildDictMgr},
  data() {
    return {
      dictCode: undefined,
    }
  },
  created() {
    let query = this.$route.query;
    this.dictCode = query.dictCode
    let title = this.$route.meta.pageTitle + " - " + query.dictCode;
    let that = this
    setTimeout(function () {
      that.$emit("setHeadTitle", title)
      that.$emit("setShowBackBtn", true)
    }, 500)
  },
  methods: {
    reloadData() {
      cleanDictCache()
      this.$refs.ChildDictMgr.reloadTableData()
      this.$refs.DictDataMgr.reloadTableData()
    }
  },
}
</script>

<style scoped>

</style>
